/*
 *  Copyright (C) 2011 Matt Van Der Westhuizen <mattpwest@gmail.com>
 * 
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 * 
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.chaoticengine.cgll.profile;

import org.chaoticengine.cgll.CGLLGameState;
import org.newdawn.slick.GameContainer;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;

/**
 * This class represents how a player has the game configured. It is typically
 * associated with a PlayerProfile, unless if the game doesn't use profiles.
 *
 * @author Matt Van Der Westhuizen <mattpwest@gmail.com>
 */
@Root(name="settings")
public class Settings {
    protected int soundVolume = 75;
    protected int musicVolume = 75;
    protected boolean widgetsTop = false;

    @Element(name="sound_volume")
    public int getSoundVolume() {
        return(soundVolume);
    }

    @Element(name="sound_volume")
    public void setSoundVolume(int vol) {
        soundVolume = vol;
    }

    @Element(name="music_volume")
    public int getMusicVolume() {
        return(musicVolume);
    }

    @Element(name="music_volume")
    public void setMusicVolume(int vol) {
        musicVolume = vol;
    }

    @Element(name="widgets_top")
    public boolean getWidgetsTop() {
        return(widgetsTop);
    }

    @Element(name="widgets_top")
    public void setWidgetsTop(boolean b) {
        widgetsTop = b;
    }

    public void applySettings(GameContainer gc, CGLLGameState game) {
        gc.setSoundVolume(soundVolume / 100.0f);
        gc.setMusicVolume(musicVolume / 100.0f);
    }
}
